<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let sse = new EventSource("http://localhost:8080/userNames");
    sse.onopen = function (event) {
        console.log("sse 连接成功");
    }
    sse.onmessage = function (event) {
        console.log(event.data);
    }
    sse.onerror = function (event) {
        console.log("sse 连接失败");
        sse.close();
    }
</script>
</body>
</html>